package com.woniuxy.Test;

import com.woniuxy.bean.Person;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class Test1 {
    public static void main(String[] args) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException {
        Properties properties = new Properties();
        //需要一个输入流
        InputStream inputStream = Test1.class.getResourceAsStream("person.properties");
        //读取输入流，转换成对象信息，并封装到Properties对象中
        properties.load(inputStream);
        //properties这个对象中，有没有办法获取到文件流中的内容？通过key获取全限定类名
        String str = properties.getProperty("person");
        Person person = (Person) Class.forName(str).newInstance();
        person.eat();
    }
}
